<?php 

namespace Home\Controller;
use Think\Controller;
//个人中心
class SettingController extends Controller {

    public function profile(){
    	// var_dump($_SESSION);
    	$this->display();
    }

    public function security()
    {
    	$this->display();
    }

    public function verify(){
    	$this->display();
    }

    public function face()
	{
        if(!empty($_FILES)){
            $config = array(
            'maxSize'    =>    3145728,
            'rootPath'   =>    './Uploads/face/',
            'savePath'   =>    '',
            'saveName'   =>    array('uniqid',''),
            'exts'       =>    array('jpg', 'gif', 'png', 'jpeg'),
            'autoSub'    =>    true,
            'subName'    =>    array('date','Ymd'),
        );
        $upload = new \Think\Upload($config);// 实例化上传类

        $info   =   $upload->upload();


        if(!$info) {// 上传错误提示错误信息
            $this->error($upload->getError());
        }else{// 上传成功 获取上传文件信息
            $info = current($info);
            $face = "Uploads/face/".$info['saveath'].$info['savename'];
            $uid = $_SESSION['id'];
            $sql = "update user set head_img='{$face}' where id= '{$uid}'";
            $model = M();
            $info = $model->execute($sql);
            $_SESSION['face'] = $face;
        }

        }else{
           $this->display(); 
        }
		
	}
    public function mail()
    {
        include ('./ThinkPHP/Library/Org/Mail.class.php');
        $info = SendMail('6955044@qq.com','test123','test123','学并思测试邮件');
        var_dump($info);

        //解释下参数: 参数1---目标邮箱, 参数2----邮件标题,参数三--邮件正文,参数四---发件人名称;
    }	
   

}













 ?>